<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
     <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
</head>
<body>

<script type="text/javascript"
	src=" <c:url value="/js/jquery-easyui-1.5.4.2/jquery.min.js"/>"></script>
<script type="text/javascript"
	src=" <c:url value="/js/jquery-easyui-1.5.4.2/jquery.easyui.min.js"/>"></script>

<script type="text/javascript"
	src=" <c:url value="/js/jquery-easyui-1.5.4.2/locale/easyui-lang-zh_CN.js"/>"></script>
<link rel="stylesheet"
	href="<c:url value="/js/jquery-easyui-1.5.4.2/themes/default/easyui.css "/>" />
<link rel="stylesheet"
	href="<c:url value="/js/jquery-easyui-1.5.4.2/themes/icon.css "/>" />

<script type="text/javascript">
$(function(){
	
	$("#aaa").linkbutton({
		onClick:function(){
			var id = $("#l_table").datagrid('getSelected').id;
			var row = $("#l_table").datagrid('getRowIndex',$("#l_table").datagrid('getSelected'));					
			$.messager.confirm('确认','您确认想要删除记录吗？',function(r){    
			    if (r){    
			    	$.getJSON("dele",{id:id});	
			    	$("#l_table").datagrid('deleteRow',row);
			    	var x=$("#l_table").datagrid('getRows');
			    	$("#l_table").datagrid('loadData',x)
					$.messager.alert('删除','删除成功！')
			    }    
			}); 									
			}
	})	
})

</script>	
	

	<table id="l_table" class="easyui-datagrid"
		data-options="fit:true,toolbar:'#tba',title:'用户信息',fitColumns:true,singleSelect:true,rownumbers:true,pagination:true,url:'tolistUser2'">
		<thead>   
        <tr>   
            <th data-options="field:'id',width:2,checkbox:true">id</th>   
            <th data-options="field:'address',width:2">地址</th>   
            <th data-options="field:'name',width:2">名字</th>
            <th data-options="field:'phone',width:2">电话</th>
            <th data-options="field:'sex',width:2">性别</th>   
        </tr>   
    </thead>     
	</table>	
	<div id="tba">
		<a id="aaa" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-clear'">删除当前行</a>
	</div>
</body>
</html>